package fileexplorer;

import org.eclipse.swt.graphics.Image;

public class FileObject implements Comparable<FileObject>{
	private int x;
	private int y;
	private boolean selected = false;
	private String nom;
	private String path;
	private NatureFile nature;
	private Image image;
	
	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public FileObject(String nom, String path, NatureFile nature, Image image) {
		this(nom,path,nature,0,0,image);
	}
	
	public FileObject(String nom, String path, NatureFile nature, int x, int y, Image image) {
		this.nom = nom;
		this.path = path;
		this.nature = nature;
		this.setX(x);
		this.setY(y);
		this.image = image;
	}
	
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public NatureFile getNature() {
		return nature;
	}
	public void setNature(NatureFile nature) {
		this.nature = nature;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public boolean isSelected() {
		return selected;
	}
	public void setSelected(boolean selected) {
		this.selected = selected;
	}

	@Override
	public int compareTo(FileObject fileObject) {
		if(this.nature==NatureFile.dossier){
			if(fileObject.getNature()!=NatureFile.dossier){
				return -1;
			}
		}else{
			if(fileObject.getNature()==NatureFile.dossier){
				return 1;
			}
		}
		return nom.compareTo(fileObject.getNom());
	}
}